#!/bin/bash
#SBATCH --job-name=earlytsc-test
#SBATCH -c 1
#SBATCH --mem=3G
set -e

DATASET=$1
METHOD=$2
ALG=$3

SEED=0

echo "$(date "+%F %T.%3N") on $HOSTNAME"
./pareto.py "$DATASET/$METHOD-$ALG" "$GLOBAL_SEED"

# now run test on all configurations in output/pareto/$DATASET/$METHOD-$ALG/confs.txt
# quite similar to validation
CONF_FILE="output/test/$DATASET/$METHOD-$ALG/confs.txt"
TEST_FILE="output/test/$DATASET/$METHOD-$ALG/test.csv"
>$TEST_FILE

INSTANCE="${UCR_ROOT}${DATASET}/${DATASET}_TRAIN.tsv:${UCR_ROOT}${DATASET}/${DATASET}_TEST.tsv"

N_ARRAY=$(( $(wc -l < $CONF_FILE)))
JOB=$( sbatch --parsable -a 1-$N_ARRAY -o /dev/null --nice=100 \
              --partition=$PARTITION --exclude=$EXCLUDE \
              slurm/run-test-batch $INSTANCE $TEST_FILE $CONF_FILE $SEED )
